<?php
	$con = mysql_connect("localhost","root","");
	if (!$con) {
		die('Could not connect: ' . mysql_error());
	}
	mysql_select_db("ciu196", $con);
	
	$roomID = $_GET["roomID"];
	$code = $_GET["code"];
	
	// Select the room the user is in
	$sql = "INSERT INTO roomcode VALUES('$roomID', '$code');";
	$res = mysql_query($sql,$con);
	if(!$res) {
		die('Error: ' . mysql_error());
	}
	
	echo "Connected room with code: " . $code;
	
	mysql_close($con);	
?>